// 原型，构造函数
function createObj(n, a){
  this.name = n;
  this.age = a;
  this.showName = function(){
    console.log(this.name)
  }
}

createObj.prototype.showAge = function(){
  console.log(this.age);
}

const obj1 = new createObj("张三", 18);
const obj2 = new createObj("李四", 20);


console.log(obj2.showName === obj1.showName);
console.log(obj2.showAge === obj1.showAge);



class createObj{
  constructor(n,a){
    this.name = n;
    this.age = a;
  };
 
  showName(){
    console.log(this.name)
  }

  showAge() {
    console.log(this.age)
  }
}